<style>
    #${className?uncap_first}-update {
        padding: 20px 25px 25px 0;
    }

    #${className?uncap_first}-update .layui-treeSelect .ztree li a, .ztree li span {
        margin: 0 0 2px 3px !important;
    }
</style>
<div class="layui-fluid" id="${className?uncap_first}-update">
    <form class="layui-form" action="" lay-filter="${className?uncap_first}-update-form">
        <#if columns??>
            <#list columns as column>
                <div class="layui-form-item<#if column.isKey = true> zzdz-hide </#if>">
                    <label class="layui-form-label zzdz-form-item-require">${column.remark}：</label>
                    <div class="layui-input-block">
                        <input type="text" name="${column.field?uncap_first}" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </#list>
        </#if>
        <div class="layui-form-item zzdz-hide">
            <button class="layui-btn" lay-submit="" lay-filter="${className?uncap_first}-update-form-submit" id="submit"></button>
        </div>
    </form>
</div>

<script data-th-inline="javascript">
    layui.use(['zzdz', 'form'], function () {
        var $ = layui.$,
            zzdz = layui.zzdz,
            layer = layui.layer,
            form = layui.form,
            ${className?uncap_first} = [[${r'${'}${className?uncap_first}${r'}'}]];
        form.render();

        init${className}Value();

        function init${className}Value() {
            form.val("${className?uncap_first}-update-form", {
                <#if columns??>
                <#list columns as column>
                "${column.field?uncap_first}":${className?uncap_first}.${column.field?uncap_first},
                </#list>
                </#if>
            });
        }

        form.on('submit(${className?uncap_first}-update-form-submit)', function (data) {
            if (zzdz.nativeEqual(data.field, ${className?uncap_first})) {
                zzdz.alert.warn('数据未作任何修改！');
                return false;
            }
            zzdz.post(ctx + '${className?uncap_first}/update', data.field, function () {
                layer.closeAll();
                zzdz.alert.success(${className?uncap_first}.type + ' ${tableComment}数据修改成功');
                $('#zzdz-${className?uncap_first}').find('#query').click();
            });
            return false;
        });
    });
</script>